#include "tabmodel1.h"

TabModel1::TabModel1( QObject * parent, QSqlDatabase db )
    : QSqlTableModel( parent, db )
{
}

TabModel1::~TabModel1()
{
}

Qt::ItemFlags TabModel1::flags( const QModelIndex & index ) const
{
Qt::ItemFlags flags = QSqlTableModel::flags(index);
    if (index.column() == 0)
    {
    return Qt::ItemIsSelectable | Qt::ItemIsEnabled;
    }
return flags;
}

QVariant TabModel1::data( const QModelIndex & index, int role ) const
{
QVariant value = QSqlTableModel::data( index, role );
        if ( role == Qt::TextColorRole && index.column() == 1 )
        {
        return qVariantFromValue( QColor(Qt::darkBlue) );
        }

        if ( role == Qt::DisplayRole && index.column() == 36 )
        {
        bool ok = false;
            if ( true != value.isNull() )
            {
            int i = value.toInt(&ok);
                if ( true == ok )
                {
                value = QVariant( QString("%L1").arg(i) );
                }
            }
        }

return value;
}

